<a href="http://github.com/angular/angular.js/tree/v1.2.10/src/ng/filter/filters.js#L54" class="view-source btn btn-action"><i class="icon-zoom-in"> </i> View source</a><a href="http://github.com/angular/angular.js/edit/master/src/ng/filter/filters.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">number</code>
<div><span class="hint">filter in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><h2 id="description">Description</h2>
<div class="description"><div class="ng-filter-page ng-filter-number-page"><p>Formats a number as text.</p>
<p>If the input is not a number an empty string is returned.</p>
</div></div>
<h2 id="usage">Usage</h2>
<div class="usage"><h3 id="usage_in-html-template-binding">In HTML Template Binding</h3>
<div class="in-html-template-binding"><code ng:non-bindable=""><span>{{</span> number_expression | number[:fractionSize] <span>}}</span></code>
</div>
<h3 id="usage_in-javascript">In JavaScript</h3>
<div class="in-javascript"><code ng:non-bindable="">$filter('number')(number[, fractionSize])</code>
</div>
<h4 id="usage_in-javascript_parameters">Parameters</h4><table class="variables-matrix table table-bordered table-striped"><thead><tr><th>Param</th><th>Type</th><th>Details</th></tr></thead><tbody><tr><td>number</td><td><a href="" class="label type-hint type-hint-number">number</a><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-filter-page ng-filter-number-page"><p>Number to format.</p>
</div></td></tr><tr><td>fractionSize <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-number">number</a><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-filter-page ng-filter-number-page"><p>Number of decimal places to round the number to.
If this is not provided then the fraction size is computed from the current locale&#39;s number
formatting pattern. In the case of the default locale, it will be 3.</p>
</div></td></tr></tbody></table><h4 id="usage_in-javascript_returns">Returns</h4><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-filter-page ng-filter-number-page"><p>Number rounded to decimalPlaces and places a “,” after each third digit.</p>
</div></td></tr></table></div>
<h2 id="example">Example</h2>
<div class="example"><div class="ng-filter-page ng-filter-number-page"><h4 id="example_source">Source</h4>
<div source-edit="" source-edit-deps="angular.js script.js" source-edit-html="index.html-136" source-edit-css="" source-edit-js="script.js-135" source-edit-json="" source-edit-unit="" source-edit-scenario="scenario.js-137" source-edit-protractor=""></div>
<div class="tabbable"><div class="tab-pane" title="index.html">
<pre class="prettyprint linenums" ng-set-text="index.html-136" ng-html-wrap=" angular.js script.js"></pre>
<script type="text/ng-template" id="index.html-136">
  
  <div ng-controller="Ctrl">
    Enter number: <input ng-model='val'><br>
    Default formatting: {{val | number}}<br>
    No fractions: {{val | number:0}}<br>
    Negative number: {{-val | number:4}}
  </div>
</script>
</div>
<div class="tab-pane" title="script.js">
<pre class="prettyprint linenums" ng-set-text="script.js-135"></pre>
<script type="text/ng-template" id="script.js-135">
    function Ctrl($scope) {
      $scope.val = 1234.56789;
    }
  </script>
</div>
<div class="tab-pane" title="ngScenario e2e test">
<pre class="prettyprint linenums" ng-set-text="scenario.js-137"></pre>
<script type="text/ng-template" id="scenario.js-137">
  it('should format numbers', function() {
    expect(binding('val | number')).toBe('1,234.568');
    expect(binding('val | number:0')).toBe('1,235');
    expect(binding('-val | number:4')).toBe('-1,234.5679');
  });

  it('should update', function() {
    input('val').enter('3374.333');
    expect(binding('val | number')).toBe('3,374.333');
    expect(binding('val | number:0')).toBe('3,374');
    expect(binding('-val | number:4')).toBe('-3,374.3330');
  });
</script>
</div>
</div><h4 id="example_demo">Demo</h4>
<div class="well doc-example-live animate-container" ng-embed-app="" ng-set-html="index.html-136" ng-eval-javascript="script.js-135"></div>
</div></div>
</div>
